<template>
	<view>
		<view class="box">
			<view class="box_1">{{$t('userdesc.userxinxi')}}</view>
			<view class="box_2">
				<view class="box2_22"><view>{{$t('schema.name')}}</view><view>{{uname}}</view></view>
				<view class="box2_22"><view>{{$t('userdesc.lianxidianhua')}}</view><view>{{tel}}</view></view>
			</view>
		</view>
		<view class="box">
			<view class="box_1">{{$t('userdesc.zhanghuxinxi')}}</view>
			<view class="box_2">
				<view class="box2_22"><view>{{$t('userdesc.status')}}</view><view v-if="ustatus==1">激活</view><view v-else>未激活</view></view>
				<view class="box2_22"><view>{{$t('userdesc.zantingdate')}}</view><view>{{suspendTime}}</view></view>
				<view class="box2_22"><view>{{$t('userdesc.jinyongdate')}}</view><view>{{disableTime}}</view></view>
				<view class="box2_22"><view>{{$t('userdesc.guanbidate')}}</view><view>{{closeTime}}</view></view>
		        <view class="box2_22"><view>{{$t('userdesc.shiyongdate')}}</view><view>{{usetime}}</view></view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getResponseData, showToastTip,getBaseUrl,getWsUrl} from "@/api/req.js";
	export default {
		data() {
			return {
				uname:"",
				tel:"",
				ustatus:1,
				stoptime:"2023-08-27 23:23:23",
				usetime:"",
				suspendTime:"",
				disableTime:"",
				closeTime:"",
			}
		},
		onLoad() {
			this.tel = uni.getStorageSync("etlSim");
			var that = this;
			getResponseData("/userInfo/getUserInfo", 'get', {}, function(res) {
				if (res.code == 200) {
					console.log(res);
					that.suspendTime = res.data.suspendTime;
					that.disableTime = res.data.disableTime;
					that.closeTime = res.data.closeTime;
					that.tel = res.data.etlSim;
					that.uname = res.data.username;
					that.ustatus = res.data.status;
					var olddate = (new Date(res.data.createTime)).getTime();
					var newdate = (new Date).getTime();
					var nian = Math.floor((newdate-olddate)/1000/86400/365);
					var yue = Math.floor((newdate-olddate)/1000/86400%365/30);
					 yue = yue>9?yue:"0"+yue;
					var ri = Math.floor((newdate-olddate)/1000/86400%365)%30;
					 ri = ri>9?ri:"0"+ri;
					 console.log(nian+"年"+yue+"月"+ri+"日");
				 	that.usetime = nian+"年"+yue+"月"+ri+"日";
					
				} else {
					uni.showToast({
						title: res.msg,
						icon: 'none',
						duration: 2000
					})
				}
			})
		},
		methods: {
			
		}
	}
</script>

<style>
page{
	background-color:ghostwhite;
}
.box_1{
	font-size: 18px;
	font-weight: 600;
	padding-top: 10px;
	padding-left: 10px;
}
.box_2{
	padding: 10px;
	margin:5px 10px 0;
	background-color: white;
	color: grey;
	border-radius: 5px;
}
.box2_22{
	display: flex;
	justify-content: space-between;
	padding: 3px 0;
}
.box2_22>view{
	line-height: 25px;
}
</style>
